home *** CD-ROM | disk | FTP | other *** search
- #include "Private.h"
-
- /*** Methods ***************************************************************/
-
- ///Text_Setup
- F_METHOD(LONG,Text_Setup)
- {
- struct LocalObjectData *LOD = F_LOD(Class,Obj);
-
- if (F_SUPERDO())
- {
- STRPTR prep;
-
- LOD -> Prep[0] = (STRPTR) F_Do(_app,FM_Application_Resolve,LOD -> Prep[0],NULL);
- LOD -> Prep[1] = (STRPTR) F_Do(_app,FM_Application_Resolve,LOD -> Prep[1],NULL);
-
- prep = LOD -> Prep[(FF_Area_Selected & _flags) ? 1 : 0];
- if (!prep) prep = LOD -> Prep[0];
-
- LOD -> TextDisplay = F_NewObj(FC_TextDisplay,
- FA_TextDisplay_PreParse, prep,
- FA_TextDisplay_Contents, LOD -> Text,
- FA_TextDisplay_Font, _font,
- FA_TextDisplay_Shortcut, (0 != (FF_Text_Shortcut & LOD -> Flags)),
- TAG_DONE);
-
- if (F_Do(LOD -> TextDisplay,FM_TextDisplay_Setup,_render))
- {
- F_Set(Obj,FA_ControlChar,F_Get(LOD -> TextDisplay,FA_TextDisplay_Shortcut));
-
- return TRUE;
- }
- }
- return FALSE;
- }
- //+
- ///Text_Cleanup
- F_METHOD(ULONG,Text_Cleanup)
- {
- struct LocalObjectData *LOD = F_LOD(Class,Obj);
-
- if (_render)
- {
- F_Do(LOD -> TextDisplay,FM_TextDisplay_Cleanup,_render);
- F_DisposeObj(LOD -> TextDisplay); LOD -> TextDisplay = NULL;
- }
-
- return F_SUPERDO();
- }
- //+
- ///Text_AskMinMax
- F_METHOD(ULONG,Text_AskMinMax)
- {
- struct LocalObjectData *LOD = F_LOD(Class,Obj);
-
- // F_Set(LOD -> TextDisplay,FA_NTextDisplay_Font,(ULONG)(_font));
-
- if (LOD -> Text)
- {
- if (FF_Area_SetMinW & _flags) _minw += F_Get(LOD -> TextDisplay,FA_TextDisplay_Width);
- if (FF_Area_SetMinH & _flags) _minh += F_Get(LOD -> TextDisplay,FA_TextDisplay_Height);
- }
- else
- {
- _minh += _font -> tf_YSize;
- }
-
- return F_SUPERDO();
- }
- //+
- ///Text_Draw
- F_METHODM(void,Text_Draw,FS_Draw)
- {
- struct LocalObjectData *LOD = F_LOD(Class,Obj);
- FRect rect;
-
- F_SUPERDO();
-
- rect.x1 = _mx; rect.x2 = rect.x1 + _mw - 1;
- rect.y1 = _my; rect.y2 = rect.y1 + _mh - 1;
-
- if (FF_Draw_Update & Msg -> Flags)
- {
- F_Do(Obj,FM_Erase,&rect,0);
- }
-
- if (FF_Text_VCenter & LOD -> Flags)
- {
- UWORD h = rect.y2 - rect.y1 + 1;
- UWORD td_h = F_Get(LOD -> TextDisplay,FA_TextDisplay_Height);
-
- if (td_h < h)
- {
- rect.y1 = (h - td_h) / 2 + rect.y1;
- }
- }
-
- if (FF_Text_HCenter & LOD -> Flags)
- {
- UWORD w = rect.x2 - rect.x1 + 1;
- UWORD td_w = F_Get(LOD -> TextDisplay,FA_TextDisplay_Width);
-
- if (td_w < w)
- {
- rect.x1 = (w - td_w) / 2 + rect.x1;
- }
- }
-
- F_Do(LOD -> TextDisplay,FM_TextDisplay_Draw,&rect);
- }
- //+
-